<template>
  <div class="logCenter">
    <el-breadcrumb separator="/">
      <el-breadcrumb-item>系统设置</el-breadcrumb-item>
      <el-breadcrumb-item>日志中心</el-breadcrumb-item>
    </el-breadcrumb>
    <div class="tabs">
      <el-tabs v-model="activeName"
        @tab-click="handleClick">
        <el-tab-pane label="登录日志"
          name="first"
          v-if="isHas('logloginlist','first')">
          <LoginLog />
        </el-tab-pane>
        <el-tab-pane label="房务日志"
          name="second"
          v-if="isHas('logroomlist','second')">
          <RoomLog />
        </el-tab-pane>
        <el-tab-pane label="修改房态日志"
          name="third"
          v-if="isHas('logroomstatelist','third')">
          <UpdateStateLog/>
        </el-tab-pane>
      </el-tabs>
    </div>

  </div>
</template>

<script>
import LoginLog from "./LoginLog";
import RoomLog from "./RoomLog";
import UpdateStateLog from "./UpdateStateLog";
import { has } from "@/public/js/util";

export default {
  data() {
    return {
      activeName: "first",
      isFirst: true
    };
  },
  methods: {
    handleClick(tab, event) {
      console.log(tab, event);
    },
    isHas(role, tab) {
      if (this.isFirst) {
        if (has(role, this)) {
          this.activeName = tab;
          this.isFirst = false;
        }
      }
      return has(role, this);
    }
  },
  components: {
    LoginLog,
    RoomLog,
    UpdateStateLog
  }
};
</script>
<style lang="scss" scoped>
.logCenter {
  .tabs {
    margin-top: 20px;
    background-color: white;
    padding: 20px 30px;
    position: relative;
  }
}
</style>